
#include "type.h"
#include "const.h"
#include "protect.h"
#include "proto.h"

public void init_8259A()
{
	// 主8259板 ICW1
	out_byte(INT_M_CTL, 0x11);
	// 从片的 ICW1
	out_byte(INT_S_CTL, 0x11);
	
	// 主片和从片的ICW2
	out_byte(INT_M_CTLMASK, INT_VECTOR_IRQ0);
	out_byte(INT_S_CTLMASK, INT_VECTOR_IRQ8);
	
	// 设置主从片的ICW3
	out_byte(INT_M_CTLMASK, 0x4);
	out_byte(INT_S_CTLMASK, 0x2);
	
	// 设置主从的ICW4
	out_byte(INT_M_CTLMASK, 0x1);
	out_byte(INT_S_CTLMASK, 0x1);
	
	// 设置OCW1
	out_byte(INT_M_CTLMASK, 0xFF);
	out_byte(INT_S_CTLMASK, 0xFF);
}